GtkStyleContext: Avoid over-eager animation cancellation
authorMatthias Clasen <mclasen@redhat.com>
Sun, 29 Jun 2014 23:33:46 +0000 (19:33 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 29 Jun 2014 23:41:11 +0000 (19:41 -0400)
When validating the style context, we are copying the animations
from one StyleValues instance to another, and cancel the old ones.
It turns out that sometimes the old and the new StyleValues are
the same, and in this case, we end up cancelling the animations
for good.

One case where breakage from this was observed is that the spinners
in gtk3-widget-factory stop spinning when you open and close a modal
dialog on page 2. This depends a bit on the window manager; the problem
can only be seen if opening the dialog causes a transition to backdrop.

gtk/gtkstylecontext.c

index 1ca31bced9c3e0416603bbec03292cfc23c4e7a4..fd804b291ecf2d292f1f7a895fa50b9b44ea1fba 100644 (file)
@@ -3058,12 +3058,13 @@ _gtk_style_context_validate (GtkStyleContext  *context,
 
       values = style_values_lookup (context);
 
-      _gtk_css_computed_values_create_animations (values,
-                                                  priv->parent ? style_values_lookup (priv->parent) : NULL,
-                                                  timestamp,
-                                                  GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
-                                                 priv->scale,
-                                                  gtk_style_context_should_create_transitions (context) ? current : NULL);
+      if (values != current)
+        _gtk_css_computed_values_create_animations (values,
+                                                    priv->parent ? style_values_lookup (priv->parent) : NULL,
+                                                    timestamp,
+                                                    GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+                                                    priv->scale,
+                                                    gtk_style_context_should_create_transitions (context) ? current : NULL);
       if (_gtk_css_computed_values_is_static (values))
         change &= ~GTK_CSS_CHANGE_ANIMATE;
       else
@@ -3075,7 +3076,8 @@ _gtk_style_context_validate (GtkStyleContext  *context,
           changes = _gtk_css_computed_values_get_difference (values, current);
 
           /* In the case where we keep the cache, we want unanimated values */
-          _gtk_css_computed_values_cancel_animations (current);
+          if (values != current)
+            _gtk_css_computed_values_cancel_animations (current);
         }
       else
         {